package com.cxf.windex.service;


import org.slf4j.Logger;

/**
 * @program: business_needs
 * @description: 任务接口
 * @author: chenxf
 * @create: 2018-11-09 10:14
 */
public interface ITask {

  //循环任务
  public boolean circlePlan() ;

  //单个任务
  public void singlePlan() ;

  public String getName();

  default void doPlan(Logger logger){
    logger.debug("{}开始.",getName());
    long start = System.currentTimeMillis();
    singlePlan();

    //循环任务
    while (circlePlan()) {
    }
    long end = System.currentTimeMillis();
    logger.debug( "{}结束.共耗时：{} 毫秒",getName(),(end - start) );
  }
}
